import http from "../../service/request.js";
import http2 from "../../service/request2.js";

// 登录
export function login(data) {
  return http2.post({
    url: "/auth/oauth/token",
    data,
  });
}

// 退出
export function getLogout(data) {
  return http.post({
    url: "/user/logout",
    data,
  });
}

// 获取用户是否存在
export function getUserPhone(data) {
  return http.get({
    url: `/auth/user/exist/${data}`,
    data,
  });
}

// 当用户存在时调用下面接口
// 获取验证码
export function getCode(data) {
  return http.post({
    url: `/checkcode/?checkCodeType=${data.checkCodeType}&param1=${data.param1}`,
  });
}

// 扫码
export function getQRCode(data) {
  return http.get({
    url: `https://open.weixin.qq.com/connect/qrconnect?appid=${appid}&redirect_uri=${encodeURIComponent(
      redirect_uri
    )}&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`,
    data,
  });
}
